import { defineStore } from "pinia";
import { useLocalStorage } from "@vueuse/core";

export const useUserStore = defineStore("user", () => {
  const userCredit = useLocalStorage("mmd" + "user", {
    userName: "",
    token: "",
  });
  const setToken = (t: string) => {
    userCredit.value.token = t;
  };
  const setUsername = (n: string) => {
    userCredit.value.userName = n;
  };
  return { userCredit, setToken, setUsername };
});
